home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / parse / rfc822_dnorm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  1.7 KB  |  83 lines

  1. /* rfc822_dnorm.c: normalise an 822 domain */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/parse/RCS/rfc822_dnorm.c,v 6.0 1991/12/18 20:23:41 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/parse/RCS/rfc822_dnorm.c,v 6.0 1991/12/18 20:23:41 jpo Rel $
  9.  *
  10.  * $Log: rfc822_dnorm.c,v $
  11.  * Revision 6.0  1991/12/18  20:23:41  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15. #include "head.h"
  16. #include "ap.h"
  17. #include "chan.h"
  18.  
  19. extern char    *bits2str();
  20.  
  21. rfc822_norm_dmn (dmn, dmnorder)
  22. register AP_ptr        dmn;
  23. int            dmnorder;
  24. {
  25.     int    retval;
  26.     char    official[LINESIZE],
  27.         mta_key[LINESIZE],
  28.         tbuf[BUFSIZ],
  29.         *one_ord[LINESIZE],
  30.         *other_ord[LINESIZE];
  31.  
  32.     if (dmn == NULL)
  33.         return NOTOK;
  34.     
  35.  
  36.     /* hardwire in local mta and site */
  37.     (void) strcpy (tbuf, dmn->ap_obvalue);
  38.     (void) str2bits (tbuf, '.', one_ord, other_ord);
  39.  
  40.     retval = tb_getdomain(dmn->ap_obvalue,
  41.                   mta_key,
  42.                   official,
  43.                   dmnorder,
  44.                   &(dmn->ap_localhub));
  45.  
  46.     dmn->ap_normalised = TRUE;
  47.     if (retval == OK) {
  48.  
  49.         dmn->ap_recognised = TRUE;
  50.         if (official[0]) {
  51.             free (dmn->ap_obvalue);
  52.             dmn->ap_obvalue = strdup(official);
  53.             PP_DBG(("rfc822_norm_dmn Official = '%s'",
  54.                 official));
  55.         }
  56.         if (mta_key[0]) {
  57.             if (dmn->ap_chankey)
  58.                 free(dmn->ap_chankey);
  59.             dmn->ap_chankey = strdup(mta_key);
  60.             PP_DBG(("rfc822_norm_dmn channel key = '%s'",
  61.                 mta_key));
  62.         }
  63.         if (dmn->ap_localhub != NULLCP)
  64.             dmn->ap_islocal = TRUE;
  65.         else
  66.             dmn->ap_islocal = FALSE;
  67.  
  68.     } else {
  69.  
  70.         dmn->ap_recognised = FALSE;
  71.         (void) sprintf(official,
  72.                    "Unknown domain '%s'",
  73.                    dmn->ap_obvalue);
  74.         dmn->ap_error = strdup(official);
  75.         PP_LOG (LLOG_EXCEPTIONS,
  76.             ("%s is not a known domain reference",
  77.              dmn->ap_obvalue));
  78.  
  79.     }
  80.  
  81.     return retval;
  82. }
  83.